//
//  HWSinglePersonImageCell.m
//  HuaWan
//
//  Created by HuaWan on 2022.
//  Copyright ©2022年 HuaWan. All rights reserved.
//

#import "HWSinglePersonImageCell.h"

@implementation HWSinglePersonImageCell

+ (id)instanceView {
    NSArray* nibView =  [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil];
    return [nibView objectAtIndex:0];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setData:(id)data delegate:(id)delegate {

    if ([data isKindOfClass:[NSDictionary class]]) {
        if ([data[@"data"] isKindOfClass:[HWSinglePersonImageCellModel class]]) {
            HWSinglePersonImageCellModel *model = data[@"data"];
            if ([model.result isEqualToString:@"剪刀"]) {
                [_myButton setImage:[UIImage imageNamed:@"jiandao_ico"] forState:UIControlStateNormal];
            } else if ([model.result isEqualToString:@"石头"]) {
                [_myButton setImage:[UIImage imageNamed:@"shitou_ico"] forState:UIControlStateNormal];
            } else if ([model.result isEqualToString:@"布"]) {
                [_myButton setImage:[UIImage imageNamed:@"bu_ico"] forState:UIControlStateNormal];
            }
        }
    }
    
}

@end


#pragma mark - Model

@implementation HWSinglePersonImageCellModel

+ (HWSinglePersonImageCellModel *)ittemModelWithResult:(NSString *)result {
    HWSinglePersonImageCellModel *model = [HWSinglePersonImageCellModel new];
    model.result = kSafeString(result);
    return model;
}

@end
